﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.woodsoft.core;
using com.woodsoft.core.Files;
using EQ1.Objects;

namespace EQ1.Elements {
  public class SuiteDefaults : UIClass , IUIElement<SuiteDefaults> {
    public SuiteDefaults ( UIDocument doc , string name )
      : base( doc , name ) {
    }
    public SuiteDefaults ( UIDocument doc )
      : this( doc , "SuiteDefaults" ) {
    }

    #region IUIElement<SuiteDefaults> Members

    public void Validate ( SuiteDefaults val , string name ) {
      UIClass par = ( UIClass ) this.ParentNode;

      if( val.LocalName != name ) {
        SuiteDefaults el = new SuiteDefaults( ( UIDocument ) val.OwnerDocument , name );
        el.Copy( val );
        val = el;
      }

      if( par.GetElement( name ) != null )
        par.RemoveElement( name );

      par.AppendChild( val );
    }

    public void Copy ( SuiteDefaults val ) {
      base.Copy( val );

      if( string.IsNullOrEmpty( val.DefaultWindowDrawTemplate ) )
        this.DefaultWindowDrawTemplate = val.DefaultWindowDrawTemplate;
      if( string.IsNullOrEmpty( val.CursorDefault ) )
        this.CursorDefault = val.CursorDefault;
      if( string.IsNullOrEmpty( val.CursorResizeNS ) )
        this.CursorResizeNS = val.CursorResizeNS;
      if( string.IsNullOrEmpty( val.CursorResizeEW ) )
        this.CursorResizeEW = val.CursorResizeEW;
      if( string.IsNullOrEmpty( val.CursorResizeNESW ) )
        this.CursorResizeNESW = val.CursorResizeNESW;
      if( string.IsNullOrEmpty( val.CursorResizeNWSE ) )
        this.CursorResizeNWSE = val.CursorResizeNWSE;
      if( string.IsNullOrEmpty( val.CursorDrag ) )
        this.CursorDrag = val.CursorDrag;
  
    }

    #endregion

    /// <summary>
    /// WindowDrawTemplate:item value reference
    /// </summary>
    public string DefaultWindowDrawTemplate {
      get {
        return this.GetElement( "DefaultWindowDrawTemplate" ).InnerText;
      }
      set {
        this.Validate( "DefaultWindowDrawTemplate" , value );
      }
    }
    /// <summary>
    /// Ui2DAnimation:item reference
    /// </summary>
    public string CursorDefault {
      get {
        return this.GetElement( "CursorDefault" ).InnerText;
      }
      set {
        this.Validate( "CursorDefault" , value );
      }
    }
    /// <summary>
    /// Ui2DAnimation:item reference
    /// </summary>
    public string CursorResizeNS {
      get {
        return this.GetElement( "CursorResizeNS" ).InnerText;
      }
      set {
        this.Validate( "CursorResizeNS" , value );
      }
    }
    /// <summary>
    /// Ui2DAnimation:item reference
    /// </summary>
    public string CursorResizeEW {
      get {
        return this.GetElement( "CursorResizeEW" ).InnerText;
      }
      set {
        this.Validate( "CursorResizeEW" , value );
      }
    }
    /// <summary>
    /// Ui2DAnimation:item reference
    /// </summary>
    public string CursorResizeNESW {
      get {
        return this.GetElement( "CursorResizeNESW" ).InnerText;
      }
      set {
        this.Validate( "CursorResizeNESW" , value );
      }
    }
    /// <summary>
    /// Ui2DAnimation:item reference
    /// </summary>
    public string CursorResizeNWSE {
      get {
        return this.GetElement( "CursorResizeNWSE" ).InnerText;
      }
      set {
        this.Validate( "CursorResizeNWSE" , value );
      }
    }
    /// <summary>
    /// Ui2DAnimation:item reference
    /// </summary>
    public string CursorDrag {
      get {
        return this.GetElement( "CursorDrag" ).InnerText;
      }
      set {
        this.Validate( "CursorDrag" , value );
      }
    }
  }
}
